package com.rmuti.test;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
import java.util.Scanner;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class HiEcp
 */
@WebServlet("/HiEcp")
public class HiEcp extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public HiEcp() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		response.setContentType("text/html;charset=UTF-8");
		PrintWriter out = response.getWriter();
		String str = "";
		if (request.getParameter("02-011-109") != null) {
			String O02_011_109 = request.getParameter("02-011-109");
			if (!O02_011_109.equals("")) {
				str += "02-011-109%7C";
			}
			
		}

if (request.getParameter("02-011-110") != null) {
			String O02_011_110 = request.getParameter("02-011-110");
			if (!O02_011_110.equals("")) {
				str += "02-011-110%7C";
			}
			
		}
if (request.getParameter("04-021-201") != null) {
			String O04_021_201 = request.getParameter("04-021-201");
			if (!O04_021_201.equals("")) {
				str += "04-021-201%7C";
			}
			
		}
if (request.getParameter("04-065-401") != null) {
			String O04_065_401 = request.getParameter("04-065-401");
			if (!O04_065_401.equals("")) {
				str += "04-065-401%7C";
			}
			
		}
if (request.getParameter("04-020-202") != null) {
			String O04_020_202 = request.getParameter("04-020-202");
			if (!O04_020_202.equals("")) {
				str += "04-020-202%7C";
			}
			
		}
if (request.getParameter("02-070-204") != null) {
			String O02_070_204 = request.getParameter("02-070-204");
			if (!O02_070_204.equals("")) {
				str += "02-070-204%7C";
			}
			
		}
if (request.getParameter("04-061-202") != null) {
			String O04_061_202 = request.getParameter("04-061-202");
			if (!O04_061_202.equals("")) {
				str += "04-061-202%7C";
			}
			
		}
if (request.getParameter("02-020-124") != null) {
			String O02_020_124= request.getParameter("02-020-124");
			if (!O02_020_124.equals("")) {
				str += "02-020-124%7C";
			}
			
		}
if (request.getParameter("02-030-101") != null) {
			String O02_030_101 = request.getParameter("02-030-101");
			if (!O02_030_101.equals("")) {
				str += "02-030-101%7C";
			}
			
		}
if (request.getParameter("02-030-103") != null) {
			String O02_030_103 = request.getParameter("02-030-103");
			if (!O02_030_103.equals("")) {
				str += "02-030-103%7C";
			}
			
		}
if (request.getParameter("02-030-102") != null) {
			String O02_030_102 = request.getParameter("02-030-102");
			if (!O02_030_102.equals("")) {
				str += "02-030-102%7C";
			}
			
		}
if (request.getParameter("02-030-104") != null) {
			String O02_030_104 = request.getParameter("02-030-104");
			if (!O02_030_104.equals("")) {
				str += "02-030-104%7C";
			}
			
		}
if (request.getParameter("02-020-125") != null) {
			String O02_020_125 = request.getParameter("02-020-125");
			if (!O02_020_125.equals("")) {
				str += "02-020-125%7C";
			}
			
		}
if (request.getParameter("04-061-203") != null) {
			String O04_061_203 = request.getParameter("04-061-203");
			if (!O04_061_203.equals("")) {
				str += "04-061-203%7C";
			}
			
		}
if (request.getParameter("04-061-304") != null) {
			String O04_061_304 = request.getParameter("04-061-304");
			if (!O04_061_304.equals("")) {
				str += "04-061-304%7C";
			}
			
		}
if (request.getParameter("04-061-303") != null) {
			String O04_061_303 = request.getParameter("04-061-303");
			if (!O04_061_303.equals("")) {
				str += "04-061-303%7C";
			}
			
		}
if (request.getParameter("04-061-401") != null) {
			String O04_061_401 = request.getParameter("04-061-401");
			if (!O04_061_401.equals("")) {
				str += "04-061-401%7C";
			}
			
		}
if (request.getParameter("04-050-202") != null) {
			String O04_050_202 = request.getParameter("04-050-202");
			if (!O04_050_202.equals("")) {
				str += "04-050-202%7C";
			}
			
		}
if (request.getParameter("04-051-205") != null) {
			String O04_051_205 = request.getParameter("04-051-205");
			if (!O04_051_205.equals("")) {
				str += "04-051-205%7C";
			}
			
		}
if (request.getParameter("04-061-302") != null) {
			String O04_061_302 = request.getParameter("04-061-302");
			if (!O04_061_302.equals("")) {
				str += "04-061-302%7C";
			}
			
		}
if (request.getParameter("04-061-402") != null) {
			String O04_061_402 = request.getParameter("04-061-402");
			if (!O04_061_402.equals("")) {
				str += "04-061-402%7C";
			}
			
		}
if (request.getParameter("04-061-205") != null) {
			String O04_061_205 = request.getParameter("04-061-205");
			if (!O04_061_205.equals("")) {
				str += "04-061-205%7C";
			}
			
		}
if (request.getParameter("04-061-309") != null) {
			String O04_061_309 = request.getParameter("04-061-309");
			if (!O04_061_309.equals("")) {
				str += "04-061-309%7C";
			}
			
		}
if (request.getParameter("04-061-307") != null) {
			String O04_061_307 = request.getParameter("04-061-307");
			if (!O04_061_307.equals("")) {
				str += "04-061-307%7C";
			}
			
		}
if (request.getParameter("04-060-101") != null) {
			String O04_060_101 = request.getParameter("04-060-101");
			if (!O04_060_101.equals("")) {
				str += "04-060-101%7C";
			}
			
		}
if (request.getParameter("04-061-204") != null) {
			String O04_061_204 = request.getParameter("04-061-204");
			if (!O04_061_204.equals("")) {
				str += "04-061-204%7C";
			}
			
		}
if (request.getParameter("04-061-307-2") != null) {
			String O04_061_307_2 = request.getParameter("04-061-307-2");
			if (!O04_061_307_2.equals("")) {
				str += "04-061-307-2%7C";
			}
			
		}
if (request.getParameter("04-063-406") != null) {
			String O04_063_406 = request.getParameter("04-063-406");
			if (!O04_063_406.equals("")) {
				str += "04-063-406%7C";
			}
			
		}
if (request.getParameter("04-061-306") != null) {
			String O04_061_306 = request.getParameter("04-061-306");
			if (!O04_061_306.equals("")) {
				str += "04-061-306%7C";
			}
			
		}
if (request.getParameter("04-061-403") != null) {
			String O04_061_403 = request.getParameter("04-061-403");
			if (!O04_061_403.equals("")) {
				str += "04-061-403%7C";
			}
			
		}
if (request.getParameter("04-061-308") != null) {
			String O04_061_308 = request.getParameter("04-061-308");
			if (!O04_061_308.equals("")) {
				str += "04-061-308%7C";
			}
			
		}
if (request.getParameter("04-061-305") != null) {
			String O04_061_305 = request.getParameter("04-061-305");
			if (!O04_061_305.equals("")) {
				str += "04-061-305%7C";
			}
			
		}
if (request.getParameter("04-061-201") != null) {
			String O04_061_201 = request.getParameter("04-061-201");
			if (!O04_061_201.equals("")) {
				str += "04-061-201%7C";
			}
			
		}
if (request.getParameter("00-031-205") != null) {
			String O00_031_205 = request.getParameter("00-031-205");
			if (!O00_031_205.equals("")) {
				str += "00-031-205%7C";
			}
			
		}
if (request.getParameter("00-041-001") != null) {
			String O00_041_001= request.getParameter("00-041-001");
			if (!O00_041_001.equals("")) {
				str += "00-041-001%7C";
			}
			
		}
if (request.getParameter("02-030-101") != null) {
			String O02_030_101 = request.getParameter("02-030-101");
			if (!O02_030_101.equals("")) {
				str += "02-030-101%7C";
			}
			
		}
if (request.getParameter("04-062-302") != null) {
			String O04_062_302 = request.getParameter("04-062-302");
			if (!O04_062_302.equals("")) {
				str += "04-062-302%7C";
			}
			
		}
if (request.getParameter("04-064-305") != null) {
			String O04_064_305 = request.getParameter("04-064-305");
			if (!O04_064_305.equals("")) {
				str += "04-064-305%7C";
			}
			
		}
if (request.getParameter("04-064-304") != null) {
			String O04_064_304 = request.getParameter("04-064-304");
			if (!O04_064_304.equals("")) {
				str += "04-064-304%7C";
			}
			
		}
if (request.getParameter("04-063-302") != null) {
			String O04_063_302 = request.getParameter("04-063-302");
			if (!O04_063_302.equals("")) {
				str += "04-063-302%7C";
			}
			
		}
if (request.getParameter("04-063-301") != null) {
			String O04_063_301 = request.getParameter("04-063-301");
			if (!O04_063_301.equals("")) {
				str += "04-063-301%7C";
			}
			
		}
if (request.getParameter("04-062-301") != null) {
			String O04_062_301 = request.getParameter("04-062-301");
			if (!O04_062_301.equals("")) {
				str += "04-062-301%7C";
			}
			
		}
if (request.getParameter("00-042-101") != null) {
			String O00_042_101 = request.getParameter("00-042-101");
			if (!O00_042_101.equals("")) {
				str += "00-042-101%7C";
			}
			
		}
if (request.getParameter("00-031-203") != null) {
			String O00_031_203 = request.getParameter("00-031-203");
			if (!O00_031_203.equals("")) {
				str += "00-031-203%7C";
			}
			
		}
if (request.getParameter("04-010-103") != null) {
			String O04_010_103 = request.getParameter("04-010-103");
			if (!O04_010_103.equals("")) {
				str += "04-010-103%7C";
			}
			
		}
if (request.getParameter("04-100-101") != null) {
			String O04_100_101 = request.getParameter("04-100-101");
			if (!O04_100_101.equals("")) {
				str += "04-100-101%7C";
			}
			
		}
if (request.getParameter("04-040-102") != null) {
			String O04_040_102 = request.getParameter("04-040-102");
			if (!O04_040_102.equals("")) {
				str += "04-040-102%7C";
			}
			
		}




		LoginServlet a = new LoginServlet();
		String e = request.getParameter("sid");
		System.out.println(e);
		URL apiCall = new URL("http://rmutiserver.appspot.com/save?sid=" + e
				+ "&data=" + str);
		System.out.println(str);
		Scanner sc = new Scanner(apiCall.openStream());
		request.setAttribute("str", str);
		request.setAttribute("sid", e);
		ServletContext c = getServletContext();
		c.setAttribute("str", str);
		c.setAttribute("sid", e);
		RequestDispatcher rd = request.getRequestDispatcher("Map.jsp");
		rd.forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	
	}

}
